

//单例模式
//饿汉模式
class Singleton {
    private static Singleton instance = new Singleton();
    private static Singleton getInstance() {
        return instance;
    }
     private Singleton() {

    }
}

//懒汉模式
class SingletonLazy {
    private static SingletonLazy instance =  null;
    private static SingletonLazy getInstance() {
        if(instance == null) {
            instance = new SingletonLazy();
        }
        return instance;
    }
    private SingletonLazy() {

    }
}
public class demo3 {

}
